1. Field of the Invention
The invention generally relates to an image compression and decompression apparatus and method, and in particular relates to an image compression and decompression apparatus and method utilizing a context modeler having a specific context model template and a context model.
2. Related Art
Joint Bi-level Image Group (JBIG) is mainly a data processing method similar to static image compression and also including decompression method. The major difference of JBIG from static image compression is that JBIG losslessly compresses binary (one-bit/pixel) images. The image compressed by JBIG can be retrieved without losing fidelity after decompression. The intent of JBIG is to replace the current, less effective G3 and G4 fax algorithms. Fax machine has been an essential facility under the office automation needs. However, current fax machines using static image compression have their drawbacks, such as: 1) a whole faxed document cannot be viewed through a terminal due to the limited resolution of the terminal; 2) the image data does not support progressive coding so that the image content can only be obtained after the whole document being outputted from the fax machine, and 3) the quality of faxed output from a grayscale image becomes very poor. This is caused by a bitmap process of the scanner that changes the grayscale image into bitmap (black and white by a threshold) and neglects the grayscale. Therefore, JBIG intends to solve the aforesaid problems and compresses document images into a specific format to be used by scanners, digital cameras, fax machines or other image input and transference devices.
The JBIG compression has the following characteristics: 1) adaptive coding; 2) lossless image compression;. An adaptive arithmetic coding is applied. It also operates compression of halftone image. The JBIG compression is supposed to have the following advantages: 2) it handles multi-level image compression; 3) less compression time; 4) less decompression time; and 5) higher compression ratio.
Two compression and decompression methods are included in the current JBIG coding. In the following descriptions, they are identified as method A and method B.
FIG. 1 shows three major portions of the compression/decompression process of method A. They are an image transformer 102, a context modeler 104 and a mathematic encoder 106. The image data 100 to be compressed by JBIG is first transformed into bit array before being processed by the context modeler 104. The context modeler 104 compresses the data through the encoder 106 according to context model template and context model of the JBIG standard. The context model template 202 and context model 204 included in the context modeler 104 are shown in (a) and (b) of FIG. 2 respectively. Each pixel of the image is composed of four bits (B0, B1, B2, B3) in FIG. 2. The image data is transformed into bit data. In the context model template 202 of the context modeler 104, the bit to be compressed is labeled “a”. According to the context model 204, ten reference context bits are used to decide the compression of the bit “a”. The ten reference context bits are: three bits (R0, R1, R2) on the left column of “a”; two bits (R3, R4) on further left column and starting from a same row; two bits (R5, R6) on top of “a”; two bits (R7, R8) on the right column and starting from an upper row; and a bit (R9). The ten reference context bits and the bit “a” are processed by the mathematic encoder 106 with JBIG format and transformed into a compressed file 108. The aforesaid method A is usually applied to monochrome image compression. The advantage is that the data do not need cutting and rejoining so as to save time. The disadvantage is that the reference context bits are on different bit planes, so their correlations and the compression ratio are less.
FIG. 3 shows an example of compression process of method B of JBIG. The image data is also transformed through an image transformer 102 of FIG. 1, through an un-shown bit plane transformer, and divided into four bit groups (B0, B1, B2, B3) respectively located on four bit planes B0, B1, B2, B3. The bit groups are transferred to a context modeler 104. The context modeler 104 compresses the data through a mathematic encoder 106 according to the context model template and context model of the JBIG standard. The aforesaid method B is usually applied to monochrome image compression. The advantage is that the bit groups are of same bit planes, so their correlations and the compression ratio are high. The disadvantages are that the data have to be cut and rejoined so it costs time and requires higher investment of software and hardware.